package com.xxd.rpt3.Entity;
 
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table; 

/**
 * @Author XuXd
 * @Description: 权限角色
 * @CreateDate: 14:03 2019-09-11
 * @Modified by: *
 */
@Entity
@Table(name = "rpt2_role")
public class Role {
	@Id
	@GeneratedValue
	int id;
	String name;
	String code;
	@ManyToOne
	@JoinColumn(name = "type_id", referencedColumnName = "id")
	RoleType roleType;

	@ManyToMany(fetch = FetchType.EAGER)
	@JoinTable(name = "rpt2_role_menu", joinColumns = { @JoinColumn(name = "role_id", referencedColumnName = "id") }, inverseJoinColumns = {
			@JoinColumn(name = "menu_id", referencedColumnName = "id") })
	List<Menu> menuList;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public RoleType getRoleType() {
		return roleType;
	}

	public void setRoleType(RoleType roleType) {
		this.roleType = roleType;
	}

	public List<Menu> getMenuList() {
		return menuList;
	}

	public void setMenuList(List<Menu> menuList) {
		this.menuList = menuList;
	}
	
}
